package runesim.testing;
import static java.lang.Math.*;
public class CombatFormulae {
	
	public static void main(String[] a) {
		System.out.println("" + calculateMaxHit(99, 0, 0, 0, 0, 0));
		System.out.println("" + CombatFormulae.calculateCombatLevel(53, 54, 24, 53, 53, 43, 48));
	}
	
	public static int calculateMaxHit(int strengthLevel, int potionBonus, int prayerBonus, int otherBonus, int combatStyle, int equipmentBonus) {
		double baseStrength = strengthLevel * (1 + potionBonus + prayerBonus + otherBonus);
		double combatStrength = baseStrength + combatStyle;
		double strengthMultiplier = (equipmentBonus * 0.00175) + 0.1;
		double maxHit = floor(combatStrength * strengthMultiplier + 1.05);
		return (int) maxHit;
	}
	
	public static int calculateCombatLevel(int defenceLevel, int hitpointLevel, int prayerLevel, int attackLevel, int strengthLevel, int rangeLevel, int magicLevel) {
		double base = 0.25 * (defenceLevel + hitpointLevel + floor(prayerLevel / 2) + 1);
		double[] hit = new double[3];
		hit[0] = 0.325 * (attackLevel + strengthLevel);
		hit[1] = 0.325 * (floor(rangeLevel * 1.5));
		hit[2] = 0.325 * (floor(magicLevel * 1.5));
		return (int) floor(base + getHighestValue(hit));
	}
	
	public static double getHighestValue(double x[]) {
		double max;
		max = x[0];
		for(int i = 0; i < x.length; i++) {
			if(max < x[i]) max = x[i];
		}
		return max;
	}
}